local skel = fk.CreateSkill {
  name = "efengqi__shourong",
  tags = {Skill.Lord},
}

Fk:loadTranslationTable{
  ["efengqi__shourong"] = "授戎",
  [":efengqi__shourong"] = "主公技，其他角色出牌阶段开始时，你可以横置，令其获得弃牌堆一张武器牌，若为汉势力角色，额外获得一张基本牌，若为蜀势力角色，回复1点体力。",
  ["#efengqi__shourong-invoke"] = "授戎：你可以横置，令 %src 获得弃牌堆一张武器牌(可能没有)，若其为汉、蜀角色额外获得收益",

  ["$efengqi__shourong1"] = "哪位将军，替我拿下此贼！",
  ["$efengqi__shourong2"] = "欺我军无人乎！",
}

skel:addEffect(fk.EventPhaseStart, {
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    return player ~= target and target.phase == Player.Play and player:hasSkill(skel.name) and not player.chained and not target.dead
  end,
  on_cost = function(self, event, target, player, data)
    if player.room:askToSkillInvoke(player, { skill_name = skel.name, prompt = "#efengqi__shourong-invoke:"..target.id}) then
      event:setCostData(self, {tos = {target}})
      return true
    end
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    player:setChainState(true)
    if target.dead then return end
    local ids = room:getCardsFromPileByRule(".|.|.|.|.|weapon")
    if #ids > 0 then
      room:obtainCard(target, ids, true, fk.ReasonJustMove, target, skel.name)
      if target.dead then return end
    end
    if target.kingdom == "han" then
      ids = room:getCardsFromPileByRule(".|.|.|.|.|basic")
      if #ids > 0 then
        room:obtainCard(target, ids, true, fk.ReasonJustMove, target, skel.name)
      end
    elseif target.kingdom == "shu" then
      room:recover { num = 1, skillName = skel.name, who = target, recoverBy = player }
    end
  end,
})



return skel
